<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<script type="text/javascript">
	$(function() {

		$('#pid').combotree({
			url : '${ctx}/auth/organization_tree',
			parentField : 'pid',
			lines : true,
			panelHeight : 'auto'
		});

		$('#organizationAddForm').form({
			url : '${ctx}/auth/organization_sava',
			onSubmit : function() {
				progressLoad();
				var isValid = $(this).form('validate');
				if (!isValid) {
					progressClose();
				}
				return isValid;
			},
			success : function(result) {
				progressClose();
				result = $.parseJSON(result);
				if (result.success) {
					parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_treeGrid这个对象，是因为organization.jsp页面预定义好了
					parent.$.modalDialog.handler.dialog('close');
				} else {
					parent.$.messager.alert('提示', result.msg, 'warning');
				}
			}
		});

	});
</script>
<div style="padding: 3px;">
	<form id="organizationAddForm" method="post">
		<table class="grid">
			<tr>
				<td>编号</td>
				<td><input name="torganization.code" type="text"
					placeholder="请输入部门编号" class="easyui-validatebox"
					data-options="required:true"></td>
				<td>部门名称</td>
				<td><input name="torganization.name" type="text"
					placeholder="请输入部门名称" class="easyui-validatebox"
					data-options="required:true"></td>

			</tr>
			<tr>
				<td>排序</td>
				<td><input name="torganization.seq"
					class="easyui-numberspinner" style="width: 140px; height: 29px;"
					required="required" data-options="editable:false" value="0"></td>
				<td>菜单图标</td>
				<td><input name="torganization.icon" value="icon-folder" /></td>
			</tr>
			<tr>
				<td>地址</td>
				<td colspan="3"><input name="torganization.address"
					style="width: 300px;" /></td>
			</tr>
			<tr>
				<td>上级部门</td>
				<td colspan="3"><select id="pid"
					name="torganization.organization.id" value="1"
					style="width: 200px; height: 29px;"></select> <a
					class="easyui-linkbutton" href="javascript:void(0)"
					onclick="$('#pid').combotree('clear');">清空</a></td>

			</tr>
		</table>
	</form>
</div>